﻿CREATE PROCEDURE [dbo].[ratings_get_book_rating]
    @bookId int,
    @userId int
AS
    SELECT 
        Rating = cast((SELECT Sum(Value) / Count(1)   From Ratings Where (Ratings.BookId = @bookId)) as nvarchar),
        IsRated = cast((SELECT Count(1) From Ratings Where (Ratings.BookId = @bookId AND Ratings.UserId = @userId)) as nvarchar)
RETURN 0
